<!--
    SpellNow, a interactive spelling program for Junior School Children.
    Copyright (C) 2007  Joshua Henderson <joshhendo@gmail.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->

<!-- THIS IS A DEVELOPMENT DEBUG PAGE
Please ignore any debugging alerts.

As any programmer would know, with debugging, just any word etc,
if put into the alert if it is to see a point and not for information
purposes (see what a count is up to etc.) Please ignore these,
as they are just for debug.
-->

<html>
	<head>
		<title>SpellNow!</title>
		<style>
			INPUT,TEXTAREA {
					font-family: serif;
					font-size: 32px;
					text-align: center;
				}

			INPUT,SELECT {
					font-family: serif;
					font-size: 32px;
					text-align: center;
				}

			body {
					text-align: center;
					font-family: serif;
					font-size: 22px;
				}

			p {
					font-family: serif;
					font-size: 22px;
				}

			div#completedList {
					visibility: hidden;
				}
			
			input[type="button"] {
					display: none;
				}
		</style>

		<script>
//		Define variables/arrays.
		var age = 5;

			function showButton(buttonName) {
				var buttons = document.getElementsByName(buttonName);
				for(var i in buttons) {
					if(buttons[i].type == "button") {
						buttons[i].style.display = "block";
					}
				}
			}
			
			function readCookie(name) {
				var nameEQ = name + "=";
				var ca = document.cookie.split(';');
				for(var i=0;i < ca.length;i++) {
					var c = ca[i];
					while (c.charAt(0)==' ') c = c.substring(1,c.length);
					if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
				}
				return null;
			}

			function doIt(num) {
				window.location = "practise.html?parm=" + num;
			}
			
			function showLevel() {
				// This function is to show the right set of level options for the age specified.
				alert("Something");
				if (age >= 4) {
					alert("Beth");
					if (age <= 8) {
						// Show levels 1 to 5
						for (i = 1; i <= 5; i++) {
							showButton(i);
						}
					}
				}
				
				if (age >= 6) {
					if (age <= 10) {
						// Show levels 5 to 15 
					}
				}
				
				if (age >= 8) {
					if (age <= 13) {
						// Show levels 15 to 38
					}
				}
			}
			
			function pageLoad() {
//				age = readCookie('studentage');
				showLevel();
			}

		</script>
	</head>
	<body onLoad="pageLoad()">
		<h1>Welcome, <script>document.write (readCookie('studentname'))</script>!</h1>
		<p>Please Select the type of level you want:<br />
			<select name="type">
				<option>Missing Letter
				<option DISABLED>Missing Word
			</select>
		</p>
		<h2>Practise!</h2><br>
		<form name="thisForm">
		<table width="75%" border="0" align="center">
		  <tr>
		    <td><center><input name="1" type="button" id="1" value="Level 1" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="2" type="button" id="2" value="Level 2" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="3" type="button" id="3" value="Level 3" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="4" type="button" id="4" value="Level 4" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="5" type="button" id="5" value="Level 5" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="6" type="button" id="6" value="Level 6" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="7" type="button" id="7" value="Level 7" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="8" type="button" id="8" value="Level 8" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="9" type="button" id="9" value="Level 9" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="10" type="button" id="10" value="Level 10" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="11" type="button" id="11" value="Level 11" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="12" type="button" id="12" value="Level 12" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="13" type="button" id="13" value="Level 13" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="14" type="button" id="14" value="Level 14" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="15" type="button" id="15" value="Level 15" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="16" type="button" id="16" value="Level 16" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="17" type="button" id="17" value="Level 17" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="18" type="button" id="18" value="Level 18" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="19" type="button" id="19" value="Level 19" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="20" type="button" id="20" value="Level 20" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="21" type="button" id="21" value="Level 21" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="22" type="button" id="22" value="Level 22" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="23" type="button" id="23" value="Level 23" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="24" type="button" id="24" value="Level 24" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="25" type="button" id="25" value="Level 25" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="26" type="button" id="26" value="Level 26" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="27" type="button" id="27" value="Level 27" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="28" type="button" id="28" value="Level 28" onClick="doIt(this.name)" DISABLED></center></td>
		    <td><center><input name="29" type="button" id="29" value="Level 29" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="30" type="button" id="30" value="Level 30" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="31" type="button" id="31" value="Level 31" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="32" type="button" id="32" value="Level 32" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="33" type="button" id="33" value="Level 33" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="34" type="button" id="34" value="Level 34" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="35" type="button" id="35" value="Level 35" onClick="doIt(this.name)"></center></td>
	      </tr>
		  <tr>
		    <td><center><input name="36" type="button" id="36" value="Level 36" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="37" type="button" id="37" value="Level 37" onClick="doIt(this.name)"></center></td>
		    <td><center><input name="38" type="button" id="38" value="Level 38" onClick="doIt(this.name)"></center></td>
		    <td></td>
		    <td></td>
	      </tr>
		  </table>
		</form>
	</body>
</html>
<script>
hideAllButtons();
showButton('1');
</script>